-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow stopping services in "starting" state #503
Conversation
…hat quickly exist within the 1s okay delay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with the fix, thanks. However, I wonder if we can spend some time on test cases. Ideally we could have a test for each of the issues this will close:
- If a service is stopped during okayWait, it 1) returns the "stopped before the okay delay" error, and 2) is actually terminated
- If the daemon is stopped during okayWait, the service is terminated
Co-authored-by: Ben Hoyt <[email protected]>
Co-authored-by: Ben Hoyt <[email protected]>
Also seems like the new daemon test is failing (sometimes). Let's ensure it's not flakey with some stress testing of the new tests. |
Vulnerability scanning failed, which is a known issue. Here is a workaround, shall we adopt it? I prepared a PR for this: #507. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test fix looks reasonable to me. Feel free to merge this PR (and we can discuss the TestDeadlock issue you found separately).
…rting state (#510) In [this PR](#503), we introduced a feature to allow stopping services that are in the starting state / within the okayDelay. However, this makes [a deadlock issue in ringbuffer a real issue](#508). So we are reverting this change now and will redo it after the deadlock is resolved.
Previously, we introduced [a fix to allow stopping services in the starting state](#503). Because of this fix, we discovered [another deadlock issue](#508), so we rolled it back. Now that the deadlock issue is [fixed by this PR](https://github.com/canonical/pebble/pull/511/files), we are reintroducing the fix about "allowing stopping services in the starting state". Benchmark test, manual test to reproduce the 3-way deadlock issue, and race test are all done and passed.
Pebble has a 1-second okayWait time period for starting services, after which, if the service is still not exited, it's considered as "running". Previously, when services were still in the starting state within this 1-second okayWait period, they couldn't be stopped. This causes some issues in tests. And, just because services have just started doesn't mean they shouldn't be allowed to stop. This PR allows services in the starting state (within the 1s okayWait period) to be stopped, no matter if it's the daemon exits (Ctrl+C in the console) or the
pebble stop
command is issued.Fixes #410
Fixes #502
Also adding two test cases: